package main

import "math"

func main(){

}
func(b *sreBreaker) Allow() error{
	success,total := b,stat.Value()
	k := b.k * float64(success)
	if total < b.request || float64(total) <K {
		return nil
	}
	dr := math.Max(0,(float64(total)-k)/float64(total+1))
	rr := b.r.Float64()

	if dr <= rr {
		return nil
	}
	return ecode.ServiceUnavailabe
}